package ua.net.gm.common.entity;

import java.util.Objects;

public class EntityType
{
    private String name;

    EntityType(String name)
    {
        if (name == null || name.isEmpty())
        {
            throw new IllegalArgumentException("Entity type can't be empty");
        }
        this.name = name;
    }

    public String getName()
    {
        return name;
    }

    @Override
    public int hashCode()
    {
        int hash = 3;
        hash = 89 * hash + Objects.hashCode(this.name);
        return hash;
    }

    @Override
    public boolean equals(Object obj)
    {
        if (obj == null)
        {
            return false;
        }
        if (getClass() != obj.getClass())
        {
            return false;
        }
        final EntityType other = (EntityType) obj;
        return Objects.equals(this.name, other.name);
    }

    @Override
    public String toString()
    {
        return name;
    }
}